/*
 * @Author: czy
 * @Date: 2021-07-13 09:34:28
 * @LastEditTime: 2021-07-15 20:13:14
 */
#ifndef __STATE_H_
#define __STATE_H_

#include "sys/type.h"

extern __attribute__((regparm(1))) int ST_CTX(PCB *current);
extern __attribute__((regparm(1))) int LD_CTX(PCB *next);

void context_switch(PCB *current, PCB *next);
void update_run_time(void);

unsigned int null2new(int (*tskBody)(void));
void new2ready(unsigned int pid);
void ready2running(void);
void running2ready(void);
void running2waiting(unsigned int pid);
void waiting2ready(unsigned int pid);
void running2termination(void);
void ready2termination(unsigned int pid);
void termination2null(PCB *task);
void run_process(PCB *task);

#endif